package me.zhengjie.modules.quartz.task;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.business.repository.OrderRepository;
import me.zhengjie.business.repository.ZhsqRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.List;

/**
 * 查询昨天待护理的订单，并把其置为过期订单
 * @author xiahongbo
 * @date 2022-11-19
 */
@Slf4j
@Async
@Component
public class GqddTask {

    @Autowired
    private OrderRepository orderRepository;

    @Transactional
    public void gqdd() {
        // 当前时间
        String datetime = DateUtil.format(DateUtil.date(), DatePattern.NORM_DATETIME_MS_PATTERN);
        log.info("查询昨天待护理的订单，并把其置为过期订单 {}" + datetime);
        orderRepository.updateGqdd();
    }
}
